<?php include "header.php";?>
<div id="all">
    <div id="main">
			<div id="m-left">
				<div class="sidebar">
					<div class="title">
						<?php echo ($lang ==0)? "Danh mục" : "Menu";?>
					</div>
					<div class="content">
						<ul>
						<?php
							if($lang == 0){
								$sqlMenus = "select id, vi_name as name, url from tblmenu where parent_id =0";
							} else{
								$sqlMenus = "select id, en_name as name, url from tblmenu where parent_id =0";
							}
							$rsMenus = mysql_query($sqlMenus) or die(mysql_error());
							while($menu = mysql_fetch_object($rsMenus)){
								echo "<li><a href='".(($menu->url =="")? (ROOT_PATH."/m/".$menu->id) : ROOT_PATH.$menu->url)."'>".$menu->name."</a></li>";
							}
						?>
						</ul>
					</div>
				</div><!-- end of sidebar -->
			</div>
			<div id="m-mid">
				
				
				
					<div class="title">
					<?php
						if($lang == 0){
							echo "Thư viện tài liệu";
						}else{
							echo "Library";
						}
					?>
					</div>
					<div class="container">
						<ul id="documents">
							
                 <?php
		

			   
			  				$query="select * from tblresource order by id asc ";
			
						  
						  	$result = mysql_query($query);
							$total = mysql_num_rows($result);
							$perPage = 2;
							$numOfPage = ceil($total/$perPage);
							
							//echo "Tong so ban ghi la : ".$total."<br>";
							//echo "Moi trang co so ban ghi la : ".$perPage."<br>";
							//echo "Tong so trang la : ".$numOfPage."<br>";
							if($_GET['page']=="")
							{
									$start=0;		  
							}
							else
							{
							if(!isset($_GET["page"]))
							{
									$start=0;
							}
							$start=($_GET['page']-1)*$perPage;
							}
							$query2 = "SELECT * FROM tblresource LIMIT $start,$perPage";
							$result2 = mysql_query($query2);
							while($row2 = mysql_fetch_array($result2))
							{
									
                			if($lang == 0){
									 echo "<li><span>".$row2["vi_name"]."</span><a href='".$row2["link"]."' title='Download tài liệu'><img src='".ROOT_PATH."/images/download.png' alt=''/></a></li>";
								}else{
									 echo "<li><span>".$row2["en_name"]."</span><a href='".$row2["link"]."' title='Click here to download'><img src='".ROOT_PATH."/images/download.png' alt=''/></a></li>";
								}
               
      
		      				}

							$ht=$_GET["page"];
							$tien=$_GET["page"]+1;
							$lui=$_GET["page"]-1;
							if($lui>0)
							{
							echo "<a href='".ROOT_PATH."/tailieu?page=".$lui."'><strong><font color='#FF0000'><<</font></strong></a> ";	
								}
							for($i=1;$i<=$numOfPage;$i++)
							{
								if($_GET["page"]==$i)
								{
									echo "<a href='".ROOT_PATH."/tailieu?page=".$i."'><strong><font color='#FF0000'>".$i."</font></strong></a> ";	
								}
								else
								{
									echo "<a href='".ROOT_PATH."/tailieu?page=".$i."'>".$i."</a> ";	
								}
							}
							if($tien<=$numOfPage)
							{
								echo "<a href='".ROOT_PATH."/tailieu?page=".$tien."'><strong><font color='#FF0000'>>></font></strong></a> ";		
							}
?>
			
               
							
						</ul>
					</div>
			</div>
			<div id="m-right">
			
				<div class="sidebar">
					<div class="title">
						<?php if($lang == 0){
							echo "Tin tức mới nhất";
						}else{
							echo "Newest news";
						}?>
					</div>
					<div class="container">
						<ul>
							<?php
								if($lang == 0){
									$sqlNews ="Select id,vi_title as title from tblarticle order by created_date desc Limit 5";
								}else{
									$sqlNews ="Select id,en_title as title from tblarticle order by created_date desc limit 5";
								}
								$rsNews = mysql_query($sqlNews) or die(mysql_error());
								while($news = mysql_fetch_object($rsNews)){
									echo "<li><a href='".ROOT_PATH."/view/".$news->id."'>".$news->title."</a></li>";
								}
								
							?>
							
						</ul>
					</div>
				</div>
			</div>
			<div class="clear-fix"></div>
		</div>
    </div>
	<div id="footer">
			<div id="f-menu">
				<ul>
					<?php foreach($arrRootMenus as $rootMenu){
						if($lang ==0){
							echo "<li><a href='".ROOT_PATH.(($rootMenu->url=="")? "/m/".$rootMenu->id: ROOT_PATH."/".$rootMenu->url)."'>".$rootMenu->vi_name."</a></li>";
						}else{
							echo "<li><a href='".ROOT_PATH.(($rootMenu->url=="")? "/m/".$rootMenu->id: ROOT_PATH."/".$rootMenu->url)."'>".$rootMenu->en_name."</a></li>";
						}
					}?>
				</ul>
			</div>
			<div id="copyright">
				Bản quyền thuộc về khoa quốc tế đại học Thái Nguyên<br/>
				Copyright &copy; 2011 <a href="http://idgit.com.vn">Idea Development Group</a>
			</div>
			
		</div>
	</div>
</body>
</html>	
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
        
     